# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=geoclue
pkgver=2.6.0
pkgrel=0
pkgdesc="dbus geolocation service"
url="https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	avahi-dev
	gobject-introspection-dev
	intltool
	json-glib-dev
	libnotify-dev
	libsoup-dev
	meson
	vala
	"
subpackages="$pkgname-dev $pkgname-doc"
install="$pkgname.pre-install"
source="
	https://gitlab.freedesktop.org/geoclue/geoclue/-/archive/$pkgver/geoclue-$pkgver.tar.bz2
	"

case "$CARCH" in
	s390x|riscv64)
		_arch_opts="-D3g-source=false -Dcdma-source=false -Dmodem-gps-source=false"
		;;
	*)
		_arch_opts=""
		makedepends="$makedepends modemmanager-dev"
		;;
esac

build() {
	abuild-meson \
		-Ddbus-srv-user=geoclue \
		-Ddbus-sys-dir=/usr/share/dbus-1/system.d \
		-Dgtk-doc=false \
		-Dintrospection=true \
		$_arch_opts \
		build
	meson compile ${JOBS:+-j ${JOBS}} -C build
}

check() {
	meson test --no-rebuild -v -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build
}

sha512sums="
13205ab88cbd9748c155081318ae1909fddedce4250e3ece39a9f379b8cfea91dfe571961e278406ba54f8efd3a1070967479feb8256f50170112b28246b3103  geoclue-2.6.0.tar.bz2
"
